package com.badshun.stage;

import com.badlogic.gdx.graphics.*;
import com.badshun.box2d.*;
import com.badshun.player.*;

public class EnvironmentStageManager {
	public EnvironmentStage stage;
	
	public MainCityStage mcs;
	public MainCityRoom1Stage mcr1s;

	public int index = 0;
	public int comparable = 0;
	
	public void createMcs(MainPlayer player,NPCPlayersManager npm,OrthographicCamera camera,Box2DWorld world) {
		stage = new MainCityStage(player,npm,camera,world);
		mcs = new MainCityStage(player,npm,camera,world);
		
		mcs.isActive = true;
	}
	
	public void createMcr1s(MainPlayer player,NPCPlayersManager npm,OrthographicCamera camera,Box2DWorld world) {
		stage = new MainCityRoom1Stage(player,npm,camera,world);
		mcr1s = new MainCityRoom1Stage(player,npm,camera,world);
		
		mcr1s.isActive = true;
	}
	
	private void gc() {
		if(!(stage == null)) {
			if(stage instanceof MainCityStage) {
				if(!(mcr1s == null)) {
					mcr1s.map.destroyBody(mcr1s.TAG);
					mcr1s = null;
				}
			} else if(stage instanceof MainCityRoom1Stage) {
				if(!(mcs == null)) {
					mcs.map.destroyBody(mcs.TAG);
					mcs = null;
				}
			}
		}
	}
	
	public void act() {
		stage.act();
	}
	
	public void  draw() {
		gc();
		
		if(!(stage == null)) {
			stage.draw();
		}
	}
}
